package admin;

import org.omg.CORBA.BooleanHolder;
import org.omg.CORBA.ORB;
import org.omg.CORBA.StringHolder;

import common.CommonTools;
import frontend.FrontEnd;
import frontend.FrontEndHelper;

public class AdminClientTest {

	public static void main(String[] args) {
		ORB orb = ORB.init(args, null);

		String playerIOR = CommonTools.getIOR("frontend", "frontend", "client");
		System.out.println("IOR:" + playerIOR);

		org.omg.CORBA.Object FrontEndServiceObject = orb
				.string_to_object(playerIOR);

		FrontEnd frontEnd = FrontEndHelper.narrow(FrontEndServiceObject);

		String adminUsername = "Admin";		
		String adminPassword = "Admin";
		String iPAddress = "132.168.1.4";
		//String iPAddress = "93.168.1.4";
		
		String userNameToSuspend = "Clinton"+args[1];

		// create account
		BooleanHolder result = new BooleanHolder();
		StringHolder status = new StringHolder();
		if (args[0].equals("status")){
			frontEnd.getPlayerStatus(adminUsername, adminPassword, iPAddress, result, status);
		} else{
			frontEnd.suspendAccount(adminUsername, adminPassword, iPAddress, userNameToSuspend,result, status);
		}

		CommonTools.writeLog("client", "client",
				"remote call response is result:" + result.value + " status: "
						+ status.value, "client");

	}

}
